<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>LCOV - code analysis - /usr/include/boost/format/format_implementation.hpp</title>
  <link rel="stylesheet" type="text/css" href="../../../../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LCOV - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
          <tr>
            <td width="10%" class="headerItem">Current view:</td>
            <td width="35%" class="headerValue"><a href="../../../../index.html">top level</a> - <a href="index.html">usr/include/boost/format</a> - format_implementation.hpp<span style="font-size: 80%;"> (source / <a href="format_implementation.hpp.func-sort-c.html">functions</a>)</span></td>
            <td width="5%"></td>
            <td width="15%"></td>
            <td width="10%" class="headerCovTableHead">Hit</td>
            <td width="10%" class="headerCovTableHead">Total</td>
            <td width="15%" class="headerCovTableHead">Coverage</td>
          </tr>
          <tr>
            <td class="headerItem">Test:</td>
            <td class="headerValue">code analysis</td>
            <td></td>
            <td class="headerItem">Lines:</td>
            <td class="headerCovTableEntry">0</td>
            <td class="headerCovTableEntry">49</td>
            <td class="headerCovTableEntryLo">0.0 %</td>
          </tr>
          <tr>
            <td class="headerItem">Date:</td>
            <td class="headerValue">2020-09-11 22:25:26</td>
            <td></td>
            <td class="headerItem">Functions:</td>
            <td class="headerCovTableEntry">0</td>
            <td class="headerCovTableEntry">7</td>
            <td class="headerCovTableEntryLo">0.0 %</td>
          </tr>
          <tr>
            <td class="headerItem">Legend:</td>
            <td class="headerValueLeg">            Lines:
            <span class="coverLegendCov">hit</span>
            <span class="coverLegendNoCov">not hit</span>
</td>
            <td></td>
          </tr>
          <tr><td><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>
        </table>
      </td>
    </tr>

    <tr><td class="ruler"><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td>
<pre class="sourceHeading">          Line data    Source code</pre>
<pre class="source">
<a name="1"><span class="lineNum">       1 </span>            : // ----------------------------------------------------------------------------</a>
<span class="lineNum">       2 </span>            : // format_implementation.hpp  Implementation of the basic_format class
<span class="lineNum">       3 </span>            : // ----------------------------------------------------------------------------
<span class="lineNum">       4 </span>            : 
<span class="lineNum">       5 </span>            : //  Copyright Samuel Krempp 2003. Use, modification, and distribution are
<span class="lineNum">       6 </span>            : //  subject to the Boost Software License, Version 1.0. (See accompanying
<span class="lineNum">       7 </span>            : //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
<span class="lineNum">       8 </span>            : 
<span class="lineNum">       9 </span>            : //  See http://www.boost.org/libs/format for library home page
<span class="lineNum">      10 </span>            : 
<span class="lineNum">      11 </span>            : 
<span class="lineNum">      12 </span>            : // ----------------------------------------------------------------------------
<span class="lineNum">      13 </span>            : 
<span class="lineNum">      14 </span>            : #ifndef BOOST_FORMAT_IMPLEMENTATION_HPP
<span class="lineNum">      15 </span>            : #define BOOST_FORMAT_IMPLEMENTATION_HPP
<span class="lineNum">      16 </span>            : 
<span class="lineNum">      17 </span>            : #include &lt;boost/config.hpp&gt;
<span class="lineNum">      18 </span>            : #include &lt;boost/throw_exception.hpp&gt;
<span class="lineNum">      19 </span>            : #include &lt;boost/assert.hpp&gt;
<span class="lineNum">      20 </span>            : #include &lt;boost/format/format_class.hpp&gt;
<span class="lineNum">      21 </span>            : #include &lt;algorithm&gt; // std::swap
<span class="lineNum">      22 </span>            : 
<span class="lineNum">      23 </span>            : namespace boost {
<span class="lineNum">      24 </span>            : 
<span class="lineNum">      25 </span>            : // ---  basic_format implementation -----------------------------------------//
<a name="26"><span class="lineNum">      26 </span>            : </a>
<span class="lineNum">      27 </span>            :     template&lt; class Ch, class Tr, class Alloc&gt;
<span class="lineNum">      28 </span><span class="lineNoCov">          0 :     basic_format&lt;Ch, Tr, Alloc&gt;:: basic_format(const Ch* s)</span>
<span class="lineNum">      29 </span>            :         : style_(0), cur_arg_(0), num_args_(0), dumped_(false),
<span class="lineNum">      30 </span><span class="lineNoCov">          0 :           exceptions_(io::all_error_bits)</span>
<span class="lineNum">      31 </span>            :     {
<span class="lineNum">      32 </span><span class="lineNoCov">          0 :         if( s)</span>
<span class="lineNum">      33 </span><span class="lineNoCov">          0 :             parse( s );</span>
<span class="lineNum">      34 </span><span class="lineNoCov">          0 :     }</span>
<span class="lineNum">      35 </span>            : 
<span class="lineNum">      36 </span>            : #if !defined(BOOST_NO_STD_LOCALE)
<span class="lineNum">      37 </span>            :     template&lt; class Ch, class Tr, class Alloc&gt;
<span class="lineNum">      38 </span>            :     basic_format&lt;Ch, Tr, Alloc&gt;:: basic_format(const Ch* s, const std::locale &amp; loc)
<span class="lineNum">      39 </span>            :         : style_(0), cur_arg_(0), num_args_(0), dumped_(false),
<span class="lineNum">      40 </span>            :           exceptions_(io::all_error_bits), loc_(loc)
<span class="lineNum">      41 </span>            :     {
<span class="lineNum">      42 </span>            :         if(s) parse( s );
<span class="lineNum">      43 </span>            :     }
<span class="lineNum">      44 </span>            : 
<span class="lineNum">      45 </span>            :     template&lt; class Ch, class Tr, class Alloc&gt;
<span class="lineNum">      46 </span>            :     basic_format&lt;Ch, Tr, Alloc&gt;:: basic_format(const string_type&amp; s, const std::locale &amp; loc)
<span class="lineNum">      47 </span>            :         : style_(0), cur_arg_(0), num_args_(0), dumped_(false),
<span class="lineNum">      48 </span>            :           exceptions_(io::all_error_bits), loc_(loc)
<span class="lineNum">      49 </span>            :     {
<span class="lineNum">      50 </span>            :         parse(s);  
<span class="lineNum">      51 </span>            :     }
<a name="52"><span class="lineNum">      52 </span>            : #endif // ! BOOST_NO_STD_LOCALE</a>
<span class="lineNum">      53 </span>            :     template&lt; class Ch, class Tr, class Alloc&gt;
<span class="lineNum">      54 </span><span class="lineNoCov">          0 :     io::detail::locale_t basic_format&lt;Ch, Tr, Alloc&gt;:: </span>
<span class="lineNum">      55 </span>            :     getloc() const {
<span class="lineNum">      56 </span><span class="lineNoCov">          0 :         return loc_ ? loc_.get() : io::detail::locale_t(); </span>
<span class="lineNum">      57 </span>            :     }
<a name="58"><span class="lineNum">      58 </span>            : </a>
<span class="lineNum">      59 </span>            :     template&lt; class Ch, class Tr, class Alloc&gt;
<span class="lineNum">      60 </span><span class="lineNoCov">          0 :     basic_format&lt;Ch, Tr, Alloc&gt;:: basic_format(const string_type&amp; s)</span>
<span class="lineNum">      61 </span>            :         : style_(0), cur_arg_(0), num_args_(0), dumped_(false),
<span class="lineNum">      62 </span><span class="lineNoCov">          0 :           exceptions_(io::all_error_bits)</span>
<span class="lineNum">      63 </span>            :     {
<span class="lineNum">      64 </span><span class="lineNoCov">          0 :         parse(s);  </span>
<span class="lineNum">      65 </span><span class="lineNoCov">          0 :     }</span>
<span class="lineNum">      66 </span>            : 
<span class="lineNum">      67 </span>            :     template&lt; class Ch, class Tr, class Alloc&gt; // just don't copy the buf_ member
<span class="lineNum">      68 </span>            :     basic_format&lt;Ch, Tr, Alloc&gt;:: basic_format(const basic_format&amp; x)
<span class="lineNum">      69 </span>            :         : items_(x.items_), bound_(x.bound_), style_(x.style_),
<span class="lineNum">      70 </span>            :           cur_arg_(x.cur_arg_), num_args_(x.num_args_), dumped_(x.dumped_),
<span class="lineNum">      71 </span>            :           prefix_(x.prefix_), exceptions_(x.exceptions_), loc_(x.loc_)
<span class="lineNum">      72 </span>            :     {
<span class="lineNum">      73 </span>            :     }
<span class="lineNum">      74 </span>            : 
<span class="lineNum">      75 </span>            :     template&lt; class Ch, class Tr, class Alloc&gt;  // just don't copy the buf_ member
<span class="lineNum">      76 </span>            :     basic_format&lt;Ch, Tr, Alloc&gt;&amp; basic_format&lt;Ch, Tr, Alloc&gt;:: 
<span class="lineNum">      77 </span>            :     operator= (const basic_format&amp; x) {
<span class="lineNum">      78 </span>            :         if(this == &amp;x)
<span class="lineNum">      79 </span>            :             return *this;
<span class="lineNum">      80 </span>            :         (basic_format&lt;Ch, Tr, Alloc&gt;(x)).swap(*this);
<span class="lineNum">      81 </span>            :         return *this;
<span class="lineNum">      82 </span>            :     }
<span class="lineNum">      83 </span>            :     template&lt; class Ch, class Tr, class Alloc&gt;
<span class="lineNum">      84 </span>            :     void  basic_format&lt;Ch, Tr, Alloc&gt;:: 
<span class="lineNum">      85 </span>            :     swap (basic_format &amp; x) {
<span class="lineNum">      86 </span>            :         std::swap(exceptions_, x.exceptions_);
<span class="lineNum">      87 </span>            :         std::swap(style_, x.style_); 
<span class="lineNum">      88 </span>            :         std::swap(cur_arg_, x.cur_arg_); 
<span class="lineNum">      89 </span>            :         std::swap(num_args_, x.num_args_);
<span class="lineNum">      90 </span>            :         std::swap(dumped_, x.dumped_);
<span class="lineNum">      91 </span>            : 
<span class="lineNum">      92 </span>            :         items_.swap(x.items_);
<span class="lineNum">      93 </span>            :         prefix_.swap(x.prefix_);
<span class="lineNum">      94 </span>            :         bound_.swap(x.bound_);
<span class="lineNum">      95 </span>            :     }
<span class="lineNum">      96 </span>            : 
<span class="lineNum">      97 </span>            :     template&lt; class Ch, class Tr, class Alloc&gt;
<span class="lineNum">      98 </span>            :     unsigned char basic_format&lt;Ch,Tr, Alloc&gt;:: exceptions() const {
<span class="lineNum">      99 </span>            :         return exceptions_; 
<span class="lineNum">     100 </span>            :     }
<span class="lineNum">     101 </span>            : 
<span class="lineNum">     102 </span>            :     template&lt; class Ch, class Tr, class Alloc&gt;
<span class="lineNum">     103 </span>            :     unsigned char basic_format&lt;Ch,Tr, Alloc&gt;:: exceptions(unsigned char newexcept) { 
<span class="lineNum">     104 </span>            :         unsigned char swp = exceptions_; 
<span class="lineNum">     105 </span>            :         exceptions_ = newexcept; 
<span class="lineNum">     106 </span>            :         return swp; 
<span class="lineNum">     107 </span>            :     }
<a name="108"><span class="lineNum">     108 </span>            : </a>
<span class="lineNum">     109 </span>            :     template&lt;class Ch, class Tr, class Alloc&gt;
<span class="lineNum">     110 </span><span class="lineNoCov">          0 :     void basic_format&lt;Ch, Tr, Alloc&gt;:: </span>
<span class="lineNum">     111 </span>            :     make_or_reuse_data (std::size_t nbitems) {
<span class="lineNum">     112 </span>            : #if !defined(BOOST_NO_STD_LOCALE)
<span class="lineNum">     113 </span><span class="lineNoCov">          0 :         Ch fill = ( BOOST_USE_FACET(std::ctype&lt;Ch&gt;, getloc()) ). widen(' ');</span>
<span class="lineNum">     114 </span>            : #else
<span class="lineNum">     115 </span>            :         Ch fill = ' ';
<span class="lineNum">     116 </span>            : #endif
<span class="lineNum">     117 </span><span class="lineNoCov">          0 :         if(items_.size() == 0)</span>
<span class="lineNum">     118 </span><span class="lineNoCov">          0 :             items_.assign( nbitems, format_item_t(fill) );</span>
<span class="lineNum">     119 </span>            :         else {
<span class="lineNum">     120 </span><span class="lineNoCov">          0 :             if(nbitems&gt;items_.size())</span>
<span class="lineNum">     121 </span><span class="lineNoCov">          0 :                 items_.resize(nbitems, format_item_t(fill));</span>
<span class="lineNum">     122 </span><span class="lineNoCov">          0 :             bound_.resize(0);</span>
<span class="lineNum">     123 </span><span class="lineNoCov">          0 :             for(std::size_t i=0; i &lt; nbitems; ++i)</span>
<span class="lineNum">     124 </span><span class="lineNoCov">          0 :                 items_[i].reset(fill); //  strings are resized, instead of reallocated</span>
<span class="lineNum">     125 </span>            :         }
<span class="lineNum">     126 </span><span class="lineNoCov">          0 :         prefix_.resize(0);</span>
<span class="lineNum">     127 </span><span class="lineNoCov">          0 :     }</span>
<a name="128"><span class="lineNum">     128 </span>            : </a>
<span class="lineNum">     129 </span>            :     template&lt; class Ch, class Tr, class Alloc&gt;
<span class="lineNum">     130 </span><span class="lineNoCov">          0 :     basic_format&lt;Ch,Tr, Alloc&gt;&amp; basic_format&lt;Ch,Tr, Alloc&gt;:: </span>
<span class="lineNum">     131 </span>            :     clear () {
<span class="lineNum">     132 </span>            :         // empty the string buffers (except bound arguments)
<span class="lineNum">     133 </span>            :         // and make the format object ready for formatting a new set of arguments
<span class="lineNum">     134 </span>            : 
<span class="lineNum">     135 </span>            :         BOOST_ASSERT( bound_.size()==0 || num_args_ == static_cast&lt;int&gt;(bound_.size()) );
<span class="lineNum">     136 </span>            : 
<span class="lineNum">     137 </span><span class="lineNoCov">          0 :         for(unsigned long i=0; i&lt;items_.size(); ++i) {</span>
<span class="lineNum">     138 </span>            :             // clear converted strings only if the corresponding argument is not  bound :
<span class="lineNum">     139 </span><span class="lineNoCov">          0 :             if( bound_.size()==0 || items_[i].argN_&lt;0 || !bound_[ items_[i].argN_ ] )</span>
<span class="lineNum">     140 </span><span class="lineNoCov">          0 :                 items_[i].res_.resize(0);</span>
<span class="lineNum">     141 </span>            :         }
<span class="lineNum">     142 </span><span class="lineNoCov">          0 :         cur_arg_=0; dumped_=false;</span>
<span class="lineNum">     143 </span>            :         // maybe first arg is bound:
<span class="lineNum">     144 </span><span class="lineNoCov">          0 :         if(bound_.size() != 0) {</span>
<span class="lineNum">     145 </span><span class="lineNoCov">          0 :             for(; cur_arg_ &lt; num_args_ &amp;&amp; bound_[cur_arg_]; ++cur_arg_)</span>
<span class="lineNum">     146 </span>            :                 {}
<span class="lineNum">     147 </span>            :         }
<span class="lineNum">     148 </span><span class="lineNoCov">          0 :         return *this;</span>
<span class="lineNum">     149 </span>            :     }
<span class="lineNum">     150 </span>            : 
<span class="lineNum">     151 </span>            :     template&lt; class Ch, class Tr, class Alloc&gt;
<span class="lineNum">     152 </span>            :     basic_format&lt;Ch,Tr, Alloc&gt;&amp; basic_format&lt;Ch,Tr, Alloc&gt;:: 
<span class="lineNum">     153 </span>            :     clear_binds () {
<span class="lineNum">     154 </span>            :         // remove all binds, then clear()
<span class="lineNum">     155 </span>            :         bound_.resize(0);
<span class="lineNum">     156 </span>            :         clear();
<span class="lineNum">     157 </span>            :         return *this;
<span class="lineNum">     158 </span>            :     }
<span class="lineNum">     159 </span>            : 
<span class="lineNum">     160 </span>            :     template&lt; class Ch, class Tr, class Alloc&gt;
<span class="lineNum">     161 </span>            :     basic_format&lt;Ch,Tr, Alloc&gt;&amp; basic_format&lt;Ch,Tr, Alloc&gt;:: 
<span class="lineNum">     162 </span>            :     clear_bind (int argN) {
<span class="lineNum">     163 </span>            :         // remove the bind of ONE argument then clear()
<span class="lineNum">     164 </span>            :         if(argN&lt;1 || argN &gt; num_args_ || bound_.size()==0 || !bound_[argN-1] ) {
<span class="lineNum">     165 </span>            :             if( exceptions() &amp; io::out_of_range_bit)
<span class="lineNum">     166 </span>            :                 boost::throw_exception(io::out_of_range(argN, 1, num_args_+1 ) ); 
<span class="lineNum">     167 </span>            :             else return *this;
<span class="lineNum">     168 </span>            :         }
<span class="lineNum">     169 </span>            :         bound_[argN-1]=false;
<span class="lineNum">     170 </span>            :         clear();
<span class="lineNum">     171 </span>            :         return *this;
<span class="lineNum">     172 </span>            :     }
<span class="lineNum">     173 </span>            : 
<span class="lineNum">     174 </span>            :     template&lt; class Ch, class Tr, class Alloc&gt;
<span class="lineNum">     175 </span>            :     int basic_format&lt;Ch,Tr, Alloc&gt;::
<span class="lineNum">     176 </span>            :     bound_args() const {
<span class="lineNum">     177 </span>            :         if(bound_.size()==0)
<span class="lineNum">     178 </span>            :             return 0;
<span class="lineNum">     179 </span>            :         int n=0;
<span class="lineNum">     180 </span>            :         for(int i=0; i&lt;num_args_ ; ++i)
<span class="lineNum">     181 </span>            :             if(bound_[i])
<span class="lineNum">     182 </span>            :                 ++n;
<span class="lineNum">     183 </span>            :         return n;
<span class="lineNum">     184 </span>            :     }
<span class="lineNum">     185 </span>            : 
<span class="lineNum">     186 </span>            :     template&lt; class Ch, class Tr, class Alloc&gt;
<span class="lineNum">     187 </span>            :     int basic_format&lt;Ch,Tr, Alloc&gt;::
<span class="lineNum">     188 </span>            :     fed_args() const {
<span class="lineNum">     189 </span>            :         if(bound_.size()==0)
<span class="lineNum">     190 </span>            :             return cur_arg_;
<span class="lineNum">     191 </span>            :         int n=0;
<span class="lineNum">     192 </span>            :         for(int i=0; i&lt;cur_arg_ ; ++i)
<span class="lineNum">     193 </span>            :             if(!bound_[i])
<span class="lineNum">     194 </span>            :                 ++n;
<span class="lineNum">     195 </span>            :         return n;
<span class="lineNum">     196 </span>            :     }
<span class="lineNum">     197 </span>            : 
<span class="lineNum">     198 </span>            :     template&lt; class Ch, class Tr, class Alloc&gt;
<span class="lineNum">     199 </span>            :     int basic_format&lt;Ch,Tr, Alloc&gt;::
<span class="lineNum">     200 </span>            :     cur_arg() const {
<span class="lineNum">     201 </span>            :       return cur_arg_+1; }
<span class="lineNum">     202 </span>            : 
<span class="lineNum">     203 </span>            :     template&lt; class Ch, class Tr, class Alloc&gt;
<span class="lineNum">     204 </span>            :     int basic_format&lt;Ch,Tr, Alloc&gt;::
<span class="lineNum">     205 </span>            :     remaining_args() const {
<span class="lineNum">     206 </span>            :         if(bound_.size()==0)
<span class="lineNum">     207 </span>            :             return num_args_-cur_arg_;
<span class="lineNum">     208 </span>            :         int n=0;
<span class="lineNum">     209 </span>            :         for(int i=cur_arg_; i&lt;num_args_ ; ++i)
<span class="lineNum">     210 </span>            :             if(!bound_[i])
<span class="lineNum">     211 </span>            :                 ++n;
<span class="lineNum">     212 </span>            :         return n;
<span class="lineNum">     213 </span>            :     }
<span class="lineNum">     214 </span>            : 
<a name="215"><span class="lineNum">     215 </span>            :     template&lt; class Ch, class Tr, class Alloc&gt;</a>
<span class="lineNum">     216 </span>            :     typename basic_format&lt;Ch, Tr, Alloc&gt;::string_type 
<span class="lineNum">     217 </span><span class="lineNoCov">          0 :     basic_format&lt;Ch,Tr, Alloc&gt;:: </span>
<span class="lineNum">     218 </span>            :     str () const {
<span class="lineNum">     219 </span><span class="lineNoCov">          0 :         if(items_.size()==0)</span>
<span class="lineNum">     220 </span>            :             return prefix_;
<span class="lineNum">     221 </span><span class="lineNoCov">          0 :         if( cur_arg_ &lt; num_args_)</span>
<span class="lineNum">     222 </span><span class="lineNoCov">          0 :             if( exceptions() &amp; io::too_few_args_bit )</span>
<span class="lineNum">     223 </span>            :                 // not enough variables supplied
<span class="lineNum">     224 </span><span class="lineNoCov">          0 :                 boost::throw_exception(io::too_few_args(cur_arg_, num_args_)); </span>
<span class="lineNum">     225 </span>            : 
<span class="lineNum">     226 </span>            :         unsigned long i;
<span class="lineNum">     227 </span>            :         string_type res;
<span class="lineNum">     228 </span><span class="lineNoCov">          0 :         res.reserve(size());</span>
<span class="lineNum">     229 </span>            :         res += prefix_;
<span class="lineNum">     230 </span><span class="lineNoCov">          0 :         for(i=0; i &lt; items_.size(); ++i) {</span>
<span class="lineNum">     231 </span>            :             const format_item_t&amp; item = items_[i];
<span class="lineNum">     232 </span>            :             res += item.res_;
<span class="lineNum">     233 </span><span class="lineNoCov">          0 :             if( item.argN_ == format_item_t::argN_tabulation) { </span>
<span class="lineNum">     234 </span>            :                 BOOST_ASSERT( item.pad_scheme_ &amp; format_item_t::tabulation);
<span class="lineNum">     235 </span><span class="lineNoCov">          0 :                 if( static_cast&lt;size_type&gt;(item.fmtstate_.width_) &gt; res.size() )</span>
<span class="lineNum">     236 </span><span class="lineNoCov">          0 :                     res.append( static_cast&lt;size_type&gt;(item.fmtstate_.width_) - res.size(),</span>
<span class="lineNum">     237 </span>            :                                         item.fmtstate_.fill_ );
<span class="lineNum">     238 </span>            :             }
<span class="lineNum">     239 </span>            :             res += item.appendix_;
<span class="lineNum">     240 </span>            :         }
<span class="lineNum">     241 </span><span class="lineNoCov">          0 :         dumped_=true;</span>
<span class="lineNum">     242 </span>            :         return res;
<a name="243"><span class="lineNum">     243 </span>            :     }</a>
<span class="lineNum">     244 </span>            :     template&lt; class Ch, class Tr, class Alloc&gt;
<span class="lineNum">     245 </span><span class="lineNoCov">          0 :     typename std::basic_string&lt;Ch, Tr, Alloc&gt;::size_type  basic_format&lt;Ch,Tr, Alloc&gt;:: </span>
<span class="lineNum">     246 </span>            :     size () const {
<span class="lineNum">     247 </span>            : #ifdef BOOST_MSVC
<span class="lineNum">     248 </span>            :        // If std::min&lt;unsigned&gt; or std::max&lt;unsigned&gt; are already instantiated
<span class="lineNum">     249 </span>            :        // at this point then we get a blizzard of warning messages when we call
<span class="lineNum">     250 </span>            :        // those templates with std::size_t as arguments.  Weird and very annoyning...
<span class="lineNum">     251 </span>            : #pragma warning(push)
<span class="lineNum">     252 </span>            : #pragma warning(disable:4267)
<span class="lineNum">     253 </span>            : #endif
<span class="lineNum">     254 </span>            :         BOOST_USING_STD_MAX();
<span class="lineNum">     255 </span><span class="lineNoCov">          0 :         size_type sz = prefix_.size();</span>
<span class="lineNum">     256 </span>            :         unsigned long i;
<span class="lineNum">     257 </span><span class="lineNoCov">          0 :         for(i=0; i &lt; items_.size(); ++i) {</span>
<span class="lineNum">     258 </span>            :             const format_item_t&amp; item = items_[i];
<span class="lineNum">     259 </span><span class="lineNoCov">          0 :             sz += item.res_.size();</span>
<span class="lineNum">     260 </span><span class="lineNoCov">          0 :             if( item.argN_ == format_item_t::argN_tabulation)</span>
<span class="lineNum">     261 </span><span class="lineNoCov">          0 :                 sz = max BOOST_PREVENT_MACRO_SUBSTITUTION (sz,</span>
<span class="lineNum">     262 </span>            :                                         static_cast&lt;size_type&gt;(item.fmtstate_.width_) );
<span class="lineNum">     263 </span><span class="lineNoCov">          0 :             sz += item.appendix_.size();</span>
<span class="lineNum">     264 </span>            :         }
<span class="lineNum">     265 </span><span class="lineNoCov">          0 :         return sz;</span>
<span class="lineNum">     266 </span>            : #ifdef BOOST_MSVC
<span class="lineNum">     267 </span>            : #pragma warning(pop)
<span class="lineNum">     268 </span>            : #endif
<span class="lineNum">     269 </span>            :     }
<span class="lineNum">     270 </span>            : 
<span class="lineNum">     271 </span>            : namespace io {
<span class="lineNum">     272 </span>            : namespace detail {
<span class="lineNum">     273 </span>            : 
<span class="lineNum">     274 </span>            :     template&lt;class Ch, class Tr, class Alloc, class T&gt; 
<span class="lineNum">     275 </span>            :     basic_format&lt;Ch, Tr, Alloc&gt;&amp;  
<span class="lineNum">     276 </span>            :     bind_arg_body (basic_format&lt;Ch, Tr, Alloc&gt;&amp; self, int argN, const T&amp; val) {
<span class="lineNum">     277 </span>            :         // bind one argument to a fixed value
<span class="lineNum">     278 </span>            :         // this is persistent over clear() calls, thus also over str() and &lt;&lt;
<span class="lineNum">     279 </span>            :         if(self.dumped_) 
<span class="lineNum">     280 </span>            :             self.clear(); // needed because we will modify cur_arg_
<span class="lineNum">     281 </span>            :         if(argN&lt;1 || argN &gt; self.num_args_) {
<span class="lineNum">     282 </span>            :             if( self.exceptions() &amp; io::out_of_range_bit )
<span class="lineNum">     283 </span>            :                 boost::throw_exception(io::out_of_range(argN, 1, self.num_args_+1 ) );
<span class="lineNum">     284 </span>            :             else return self;
<span class="lineNum">     285 </span>            :         }
<span class="lineNum">     286 </span>            :         if(self.bound_.size()==0) 
<span class="lineNum">     287 </span>            :             self.bound_.assign(self.num_args_,false);
<span class="lineNum">     288 </span>            :         else 
<span class="lineNum">     289 </span>            :             BOOST_ASSERT( self.num_args_ == static_cast&lt;signed int&gt;(self.bound_.size()) );
<span class="lineNum">     290 </span>            :         int o_cur_arg = self.cur_arg_;
<span class="lineNum">     291 </span>            :         self.cur_arg_ = argN-1; // arrays begin at 0
<span class="lineNum">     292 </span>            : 
<span class="lineNum">     293 </span>            :         self.bound_[self.cur_arg_]=false; // if already set, we unset and re-sets..
<span class="lineNum">     294 </span>            :         self.operator%(val); // put val at the right place, because cur_arg is set
<span class="lineNum">     295 </span>            :     
<span class="lineNum">     296 </span>            : 
<span class="lineNum">     297 </span>            :         // Now re-position cur_arg before leaving :
<span class="lineNum">     298 </span>            :         self.cur_arg_ = o_cur_arg; 
<span class="lineNum">     299 </span>            :         self.bound_[argN-1]=true;
<span class="lineNum">     300 </span>            :         if(self.cur_arg_ == argN-1 ) {
<span class="lineNum">     301 </span>            :             // hum, now this arg is bound, so move to next free arg
<span class="lineNum">     302 </span>            :             while(self.cur_arg_ &lt; self.num_args_ &amp;&amp; self.bound_[self.cur_arg_])   
<span class="lineNum">     303 </span>            :                 ++self.cur_arg_;
<span class="lineNum">     304 </span>            :         }
<span class="lineNum">     305 </span>            :         // In any case, we either have all args, or are on an unbound arg :
<span class="lineNum">     306 </span>            :         BOOST_ASSERT( self.cur_arg_ &gt;= self.num_args_ || ! self.bound_[self.cur_arg_]);
<span class="lineNum">     307 </span>            :         return self;
<span class="lineNum">     308 </span>            :     }
<span class="lineNum">     309 </span>            : 
<span class="lineNum">     310 </span>            :     template&lt;class Ch, class Tr, class Alloc, class T&gt; basic_format&lt;Ch, Tr, Alloc&gt;&amp;
<span class="lineNum">     311 </span>            :     modify_item_body (basic_format&lt;Ch, Tr, Alloc&gt;&amp; self, int itemN, T manipulator) {
<span class="lineNum">     312 </span>            :         // applies a manipulator to the format_item describing a given directive.
<span class="lineNum">     313 </span>            :         // this is a permanent change, clear or reset won't cancel that.
<span class="lineNum">     314 </span>            :         if(itemN&lt;1 || itemN &gt; static_cast&lt;signed int&gt;(self.items_.size() )) {
<span class="lineNum">     315 </span>            :             if( self.exceptions() &amp; io::out_of_range_bit ) 
<span class="lineNum">     316 </span>            :                 boost::throw_exception(io::out_of_range(itemN, 1, static_cast&lt;int&gt;(self.items_.size()) ));
<span class="lineNum">     317 </span>            :             else return self;
<span class="lineNum">     318 </span>            :         }
<span class="lineNum">     319 </span>            :         self.items_[itemN-1].fmtstate_. template apply_manip&lt;T&gt; ( manipulator );
<span class="lineNum">     320 </span>            :         return self;
<span class="lineNum">     321 </span>            :     }
<span class="lineNum">     322 </span>            : 
<span class="lineNum">     323 </span>            : } // namespace detail
<span class="lineNum">     324 </span>            : } // namespace io
<span class="lineNum">     325 </span>            : } // namespace boost
<span class="lineNum">     326 </span>            : 
<span class="lineNum">     327 </span>            : 
<span class="lineNum">     328 </span>            : 
<span class="lineNum">     329 </span>            : #endif  // BOOST_FORMAT_IMPLEMENTATION_HPP
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="ruler"><img src="../../../../glass.png" width=3 height=3 alt=""></td></tr>
    <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.12</a></td></tr>
  </table>
  <br>

</body>
</html>
